﻿<%@ Page Language="C#" MasterPageFile="~/web.master" AutoEventWireup="true" CodeBehind="loan_list.aspx.cs" Inherits="Shuba.Web.master.loan_list"%>
<%@ Register Assembly="Shuba.Framework" Namespace="Shuba.Framework" TagPrefix="cc" %>
<asp:Content ID="Header1" ContentPlaceHolderID="HeaderPlaceHolder" runat="server">
	<script type="text/javascript">
		function PrintThis() {
			var txt = document.getElementById('<%= txtSearch.ClientID %>').value;
			window.open("loan_list_excel.aspx?txtSearch=" + txt);
		}
		 function CheckAll()
        {
            var checkVal;
            if(document.all("ButSelect").value == "Check All")
            {
                checkVal = true;
                document.all("ButSelect").value = "Un-Check All";
            }else
            {
                checkVal = false;
                document.all("ButSelect").value = "Check All";
            }
            
            for (var n = 0; n < document.forms[0].length; n++) 
            {
                elm = document.forms[0].elements[n];
                if (elm.type == 'checkbox') 
                {
                    elm.checked = checkVal;
                }
            }
        }
    </script>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <table class="text" border="0" width="100%" cellspacing="0" cellpadding="2">
        <tr>
            <td class="text bg_content" bgcolor="#FFFFFF" align="center">
                <p>
                    &nbsp;</p>
                <table class="black" border="0" width="95%" cellspacing="0" cellpadding="0">
                    <tr>
                        <td class="title_back" align="left">
					    <table class="text" border="0" width="100%" cellspacing="0" cellpadding="0">
					    <tr>
					    <td class="title_back2" width="2%">&nbsp;</td>
					    <td class="title_back2 title_white" width="38%"><asp:Label ID="LabelTitle" runat="server" Text="Label"></asp:Label></td>
					    <td><span class="title_right"></span></td>
					    </tr>
					    </table>
                        </td>
                        <td class="title_back" align="right">
                            <asp:LinkButton ID="btnUpload" runat="server" PostBackUrl="loan_upload.aspx" CssClass="black">Upload Data</asp:LinkButton>&nbsp;&nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td class="border_left bg_subtitle_white">&nbsp;&nbsp;&nbsp;List</td>
                        <td class="border_right bg_subtitle" align="right">
                            CIF / Debtor Name&nbsp;<asp:TextBox ID="txtSearch" CssClass="text" runat="server"></asp:TextBox>&nbsp;
                            <asp:Button ID="btnSearch" CssClass="buttonsmall" runat="server" Text="Search" OnClick="btnSearch_Click" />&nbsp;&nbsp;
                            <input type="button" value="Export to Excel" onclick="PrintThis();" class="button" />&nbsp;&nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td class="border" colspan="2">
                    <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                        <ContentTemplate>
                            <cc:SHUBAGrid ID="gvList" runat="server" AutoGenerateColumns="False" Width="100%" 
                                DataKeyNames="PROSPECT_NO" 
                                AllowPaging="True" PageSize="20" OnPageIndexChanging="gvList_PageIndexChanging"
                                OnRowDataBound="gvList_RowDataBound" OnRowCommand = "gvList_RowCommand"
                                AllowSorting="True" OnSorting="gvList_Sorting">
                                <Columns>                              
                                    <asp:BoundField DataField="PROSPECT_NO" HeaderText="APPLICATION NO" SortExpression="PROSPECT_NO" ItemStyle-HorizontalAlign=Center />
                                    <asp:BoundField DataField="DEBTOR_TYPE" HeaderText="TYPE OF REQUEST" SortExpression="DEBTOR_TYPE" ItemStyle-HorizontalAlign=Center />
                                    <asp:BoundField DataField="CIF_NUMBER" HeaderText="CIF" SortExpression="CIF_NUMBER" ItemStyle-HorizontalAlign=Center />
                                    <asp:BoundField DataField="PRODUCT_CODE" HeaderText="PRODUCT CODE" SortExpression="PRODUCT_CODE" ItemStyle-HorizontalAlign=Center />
                                    <asp:BoundField DataField="PROGRESS_STATUS" HeaderText="PROSPECT STATUS" SortExpression="PROGRESS_STATUS" ItemStyle-HorizontalAlign=Center />
                                    <asp:BoundField DataField="LOAN_NUMBER" HeaderText="LOAN NUMBER" SortExpression="LOAN_NUMBER" ItemStyle-HorizontalAlign=Center />
                                    <asp:BoundField DataField="LINE_NUMBER" HeaderText="LINE NUMBER" SortExpression="LINE_NUMBER" ItemStyle-HorizontalAlign=Center />
                                    <asp:BoundField DataField="OPEN_DATE" HeaderText="OPEN DATE" SortExpression="OPEN_DATE" DataFormatString="{0:dd MMM yyyy hh:mm:ss tt}"  ItemStyle-HorizontalAlign=Center/>
                                    <asp:BoundField DataField="DISBURSE_AMOUNT" HeaderText="DISBURSE AMOUNT" SortExpression="DISBURSE_AMOUNT" DataFormatString="{0:N0}" ItemStyle-HorizontalAlign=Right/>
                                    <asp:TemplateField HeaderStyle-Width="20%">
                                        <ItemTemplate>
                                            [&nbsp;&nbsp;<asp:LinkButton ID="btnDelete" CssClass="line" runat="server" CommandName="Remove" CommandArgument='<%#Eval("CIF_NUMBER") + "~" + Eval("LOAN_NUMBER")%>' OnClientClick="return confirm('Are you sure, you want to delete this record')">DELETE</asp:LinkButton>&nbsp;&nbsp;]
                                        </ItemTemplate>
                                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                    </asp:TemplateField>                                    
                                </Columns>
                                <PagerSettings Mode="Numeric" Visible="true" />
                                <EmptyDataTemplate>
                                    <table class="text" width=100% cellpadding=0 cellspacing=0><tr><td class="bg_grid2" align=center>NO RECORD FOUND</td></tr></table>
                                </EmptyDataTemplate>
                            </cc:SHUBAGrid>
                    </ContentTemplate>
                    <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="gvList" EventName="PageIndexChanging"/>
                    <asp:AsyncPostBackTrigger ControlID="btnSearch" EventName="Click"/>
                    </Triggers>
                    </asp:UpdatePanel>
                        </td>
                    </tr>
                </table>
                <br />
			    <!-- Error Message -->
			    <table runat=server visible=false id="ErrBox" border="0" width="100%" cellspacing="0" cellpadding="2">
			    <tr>
			    <td class="bg_grid2" align=center><asp:Label ID="ErrMsg" runat="server" Text="" Font-Bold=true ForeColor="Red"></asp:Label></td>
			    </tr>
			    </table>
			    <!-- End Of Error Message -->                
            <!-- APPROVAL START HERE -->
            <br /><br />
           <asp:Panel ID="ApprovalPnl" Visible=false runat="server">
            <table class="black" border="0" width="95%" cellspacing="0" cellpadding="0">
                <tr>
                    <td class="title_back" align="left" width=40%>
					    <table class="text" border="0" width="100%" cellspacing="0" cellpadding="0">
					        <tr>
					        <td class="title_back2" width="2%">&nbsp;</td>
					        <td class="title_back2 title_white" width="38%">Need for Approval</td>
					        <td><span class="title_right" width="60%"></span></td>
					        </tr>
					    </table>
                    </td>
                    <td class="title_back" align="right">&nbsp;&nbsp;</td>
                </tr>
                <tr>
                    <td class="border" colspan="2">
                    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                        <ContentTemplate>
                        <cc:SHUBAGrid ID="ApprovalGrid" runat="server" AutoGenerateColumns="False" Width="100%"
                            DataKeyNames="LOAN_NUMBER" 
                            AllowPaging="True" PageSize="20" 
                            OnPageIndexChanging="ApprovalGrid_PageIndexChanging"
                            AllowSorting="True" OnSorting="ApprovalGrid_Sorting">
                            <Columns>
                              <asp:TemplateField HeaderStyle-HorizontalAlign="Center" HeaderStyle-VerticalAlign="Middle" HeaderStyle-Width="10%" ItemStyle-HorizontalAlign="Center">
                                    <HeaderTemplate>
                                        <input type=button id="ButSelect" name="ButSelect" value="Check All" class="button" onclick="CheckAll()">
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <asp:CheckBox ID="chkItemSelect" runat="server" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                    <asp:BoundField DataField="CIF_NUMBER" HeaderText="CIF" SortExpression="CIF_NUMBER" ItemStyle-HorizontalAlign=Center />
                                    <asp:BoundField DataField="LOAN_NUMBER" HeaderText="LOAN NUMBER" SortExpression="LOAN_NUMBER" ItemStyle-HorizontalAlign=Center />
                                    <asp:BoundField DataField="APP_REF_NO" HeaderText="APP. REFF. NO" SortExpression="APP_REF_NO" ItemStyle-HorizontalAlign=Center />
                                    <asp:BoundField DataField="PRODUCT_CODE" HeaderText="PRODUCT CODE" SortExpression="PRODUCT_CODE" ItemStyle-HorizontalAlign=Center />
                                    <asp:BoundField DataField="LINE_NUMBER" HeaderText="LINE NUMBER" SortExpression="LINE_NUMBER" ItemStyle-HorizontalAlign=Center />
                                    <asp:BoundField DataField="OPEN_DATE" HeaderText="OPEN DATE" SortExpression="OPEN_DATE" DataFormatString="{0:dd MMM yyyy hh:mm:ss tt}"  ItemStyle-HorizontalAlign=Center/>
                                    <asp:BoundField DataField="DISBURSE_AMOUNT" HeaderText="DISBURSE AMOUNT" SortExpression="DISBURSE_AMOUNT" DataFormatString="{0:N0}" ItemStyle-HorizontalAlign=Right/>
                                    <asp:BoundField DataField="ACT_TYPE" HeaderText="TYPE" SortExpression="ACT_TYPE" ItemStyle-HorizontalAlign=Center />
                                    <asp:BoundField DataField="ENTRY_BY" HeaderText="MAKER" SortExpression="ENTRY_BY" ItemStyle-HorizontalAlign=Center />
                                    <asp:BoundField DataField="ENTRY_DATE" HeaderText="DATE" SortExpression="ENTRY_DATE" DataFormatString="{0:dd MMM yyyy hh:mm:ss tt}"  ItemStyle-HorizontalAlign=Center/>
                            </Columns>
                            <PagerSettings Mode="Numeric" Visible="true" />
                        </cc:SHUBAGrid>
                    </ContentTemplate>
                    <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="btnSearch" EventName="Click"/>
                    </Triggers>
                    </asp:UpdatePanel>
                    </td>
                </tr>
                 <tr>
                    <td colspan="2" align="left" class="bg_footer" height="30">&nbsp;
                    <asp:Button ID="btnApprove" Text="Approve" runat="server" CssClass="button" OnClick="btnApprove_Click" OnClientClick="return ApproveValidate();" />
                    <asp:Button ID="btnApproveAll" Text="Approve All" runat="server" CssClass="button" OnClick="btnApproveAll_Click" OnClientClick="return confirm('Are you sure, you want to approve all record(s) ?')" />
                    <asp:Button ID="btnReject" Text="Reject" runat="server" CssClass="button" OnClick="btnReject_Click" OnClientClick="return RejectValidate();" />
                    <asp:Button ID="btnRejectAll" Text="Reject All" runat="server" CssClass="button" OnClick="btnRejectAll_Click" OnClientClick="return confirm('Are you sure, you want to reject all record(s) ?')" />
                    </td>
                </tr>    
            </table>
           </asp:Panel>
           <!-- END OF APPROVALE -->
            </td>
        </tr>
    </table>
</asp:Content>
